﻿using Raven;
using UnityEngine;
using Vector2 = Raven.Vector2;

public class GraveDisplay : UnityDisplayObject
{
    private GraveRecord _grave;

    private static Vector3[] rip =
    {
        new Vector3(-4, -5),
        new Vector3(-4, 3),
        new Vector3(-3, 5),
        new Vector3(-1, 6),
        new Vector3(1, 6),
        new Vector3(3, 5),
        new Vector3(4, 3),
        new Vector3(4, -5),
        new Vector3(-4, -5)
    };

    public GraveDisplay(BaseGameEntity entity) : base(entity)
    {
        _grave = entity as GraveRecord;
    }
    
    public override void Start()
    {
        base.Start();
        Vector2 pos = _grave.Pos();
        _gameObject.transform.position = new Vector3((float)pos.x, (float)pos.y);
        _gameObject.AddComponent<MeshFilter>().mesh =
            MeshFactory.CloseShape(rip, new Color(133.0f / 255, 90.0f / 255, 0));
        MeshRenderer render = _gameObject.AddComponent<MeshRenderer>();
        render.material = new Material(Shader.Find("Sprites/Default"));
    }

    public override void Update()
    {
    }


}